<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>新增收货地址</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="__PUBLIC__/weixin/css/mui.css" />
		<link rel="stylesheet" href="__PUBLIC__/weixin/css/public.css" />
		<style type="text/css">
			.mui-content{
				padding-bottom: 50px;
			}
			.address-tit {
				padding-right: 8px;
				vertical-align: top;
			}
			
			.mui-table-view-cell:after {
				left: 0;
			}
			
			.mui-table-view-cell input,.mui-table-view-cell textarea {
				width: 65%;
				margin-bottom: 0;
				padding: 0;
				border: 0;
				font-size: 14px;
				color: #999;
			}
			.mui-table-view-cell input {
				height: 21px;
			}
			.mui-table-view-cell textarea {
				height: 42px;
			}
		</style>
	</head>

	<body>
		
		<div id="muiContent" class="mui-content mui-scroll-wrapper">
			<div class="mui-scroll">
				<ul class="mui-table-view">

					<li class="mui-table-view-cell">
						<a class="">
							<span class="address-tit">收<ins class="half_words"></ins>货<ins class="half_words"></ins>人：</span>
							<input type="text" id="consignee" placeholder="请输入收货人">
						</a>
					</li>
					<li class="mui-table-view-cell">
						<a class="">
							<span class="address-tit">邮<ins class="two_words"></ins>编：</span>
							<input type="text" id="zip" placeholder="请输入邮编">
						</a>
					</li>
					
					<li class="mui-table-view-cell">
						<a class="">
							<span class="address-tit">联系电话：</span>
							<input type="text" id="tel" placeholder="请输入联系电话">
						</a>
					</li>
					<li class="mui-table-view-cell">
						<a id="showCityPicker3" class="">
							<span class="address-tit">收货地址：</span>
							<textarea id="address" rows="2" placeholder="请输入收货地址"></textarea>
						</a>
					</li>
				</ul>
			</div>
		</div>
		<nav class="mui-bar mui-bar-tab">
			<div class="pt3 plr10">
				<button id="saveAddress" type="button" class="mui-btn mui-btn-block btn-foot">保存</button>
			</div>
		</nav>
	</body>
        <script src="__PUBLIC__/js/jquery.min.js"></script>
	<script src="__PUBLIC__/weixin/js/mui.min.js"></script>
	<script>
                var goods_id = "{$id}";
				var goods_spec_id ="{$goods_spec_id}";
		mui.init();
		
		mui('.mui-scroll-wrapper').scroll({
			deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
		});
		
		mui.plusReady(function() {
			
		});
		document.getElementById("saveAddress").addEventListener('tap',save);
		function save(){
			var data = {
				'consignee' : document.getElementById("consignee").value,
				'zip' : document.getElementById("zip").value,
				'tel' : document.getElementById("tel").value,
				'address' : document.getElementById("address").value
			}
			
			$.ajax({
                            url:"{:U('Weixin/Index/doAddAddress')}",
                            type:"post",
                            dataType:"json",
                            data:data,
                            success:function(data){
                                window.location.href = "{:U('Weixin/Index/address')}"+"?id="+goods_id+"&goods_spec_id="+goods_spec_id;
                            }
                        })
		}
	</script>

</html>